<script setup lang="ts">
import { ref } from 'vue'
import radioCell from '@/components/radio-cell.vue'

const emit = defineEmits(['close'])
const show = ref(false)
defineExpose({
  show,
})

const editRef = ref()
const formModel = ref({
  balance: 120,
  money: 120,
  mchID: '',
})

function handleSubmit() {
  editRef.value.validate().then(({ valid, errors }) => {
    if (valid) {
      console.log('表单验证通过')
      // 提交表单逻辑
      emit('close', false)
      show.value = false
    }
    else {
      console.log('表单验证不通过')
    }
  })
}
function handleClose() {
//   show.value = false

}

const list = [100, 200, 500, 1000, 2000, 5000]
</script>

<template>
  <wd-popup v-model="show" lock-scroll position="bottom" :safe-area-inset-bottom="true" closable custom-style="height: 800rpx;overflow: hidden;border-radius: 32rpx 32rpx 0 0;" @close="handleClose">
    <view class="wot-form-title">
      【 服务费 转至 其他商户余额 】
    </view>
    <scroll-view scroll-y>
      <wd-form ref="editRef" :model="formModel" class="form">
        <wd-cell-group border>
          <wd-input
            v-model="formModel.balance"
            label="服务费余额："
            label-width="100px"
            prop="name"
            clearable
            readonly
          />
          <wd-cell title="转出金额：" title-width="100px">
            <view class="inp-num">
              <wd-input-number v-model="formModel.money" input-width="70px" :step="5" custom-class="inp-num" />
            </view>
          </wd-cell>
          <view class="wot-tips text-red">
            金额为正数
          </view>
          <wd-input
            v-model="formModel.mchID"
            label="商户ID："
            label-width="100px"
            prop="mchID"
            :rules="[{ required: true, message: '请填写对方商户ID' }]"
            clearable
          />
          <view class="wot-tips text-red">
            对方商户ID号 , 5~8位数字
          </view>
        </wd-cell-group>
        <view class="desc">
          注：转出服务费，将直接扣除当前您账户下服务费的设定金额，同时将增对方商户的服务费余额，请确认对方商户ID再进行操作。
        </view>
        <view class="settings" @click="handleSubmit">
          按设定金额 把服务费 转至 其他账户服务费
        </view>
      </wd-form>
    </scroll-view>
  </wd-popup>
</template>

<style lang="scss" scoped>
.form {
  padding: 0 60rpx;
}
.desc{
    padding: 40rpx 20rpx;
    line-height: 40rpx;
    font-size: 24rpx;
    color: #ED6A0C;
}
.footer{
  padding: 0 30rpx;

}
.inp-num {
  text-align: left;
  margin-bottom: 4rpx;
}
.money-item{
  height: 64rpx;
  line-height: 64rpx;
  text-align: center;
  font-size: 24rpx;
  color: #fff;
  background-color: $uni-color-secondary;
  border-radius: 8rpx;
  margin-bottom: 10rpx;
}
.settings{
    font-size: 24rpx;
    color: #fff;
    font-weight: bold;
    background-color: $uni-color-primary;
    width: 80%;
    line-height: 62rpx;
    text-align: center;
    margin: 40rpx auto;
    border-radius: 6rpx;
    cursor: pointer;
    &:active{
      background-color: #087bf9;
    }
}
</style>
